﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.JsonPatch.Internal;
using Microsoft.AspNetCore.Mvc;
using S.Authorization.Read.API.Application.Command.OrganizationCommand;
using S.Authorization.Read.API.Dto;

namespace S.Authorization.Read.API.Controllers.Organization
{
    /// <summary>
    /// 行业
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class IndustryController : ControllerBase
    {
        private IMediator mediator;
        public IndustryController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 行业显示
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("IndustryList")]
        public async Task<IActionResult> IndustryList(int PID)
        {

            return Ok(await mediator.Send(new IndustryModelCommand() {PID=PID }));

        }

        /// <summary>
        /// 显示单位表（企业，集团，系统）
        /// ID和Name
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetBusiness")]
        public async Task<List<GetBusinessDto>> GetBusiness()
        {
            return await mediator.Send(new BusinessGetCommand());
        }
        
    }
}
